<?php

namespace app\controller\v1\admin;

use app\BaseController;
use app\common\Send;
use app\service\CashMoneyService;
use app\utils\CashMoneyEmun;
use think\App;
use think\Request;

class CashMoney extends BaseController
{
    use Send;
    private $cashMemberService;

    public function __construct(App $app, CashMoneyService $cashMemberService){
        parent::__construct($app);
        $this->cashMemberService = $cashMemberService;
    }

    public function index(Request $request){
        $params = $request->param();
        $list = $this->cashMemberService->list($params);
        return self::success($list);
    }

    public function status()
    {
        return self::success(CashMoneyEmun::cashMoneyStatusText());
    }

    /**
     * 保存更新
     */
    public function update(Request $request, $id)
    {
        $params = $request->param();

        $result = $this->cashMemberService->update($id, $params);
        return self::success($result);
    }
}
